package com.itheima.springbootrequestresponse.dao.impl;

import com.itheima.springbootrequestresponse.dao.EmpDao;
import com.itheima.springbootrequestresponse.pojo.Emp;
import com.itheima.springbootrequestresponse.util.XmlParserUtils;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import java.util.List;

@Component
@Repository
public class EmpDaoImpl implements EmpDao {
    @Override
    public List<Emp> list() {
        String file = this.getClass().getClassLoader().getResource("emp.xml").getFile();

         List<Emp> empList = XmlParserUtils.parse(file, Emp.class);
         return empList;
    }
}
